import java.util.Scanner;

/**
 * @Title: 试除法判定质数
 * @Author 贾金博
 * @Package PACKAGE_NAME
 * @Date 2024/3/15 11:08
 * @description:
 */
public class 试除法判定质数 {
    public static Scanner sc = new Scanner(System.in);

    public static void main(String[] args) {
        long n = sc.nextLong();
        for(int i = 1; i <= n; ++ i ) {
            long x = sc.nextLong();
            System.out.println( isPrime(x) ? "Yes" : "No");
        }
    }

    public static boolean isPrime(long x) {
        if(x < 2) {
            return false; // 对1的特判
        }
        for(long i = 2; i  <= x / i; ++ i ) {
            if(x % i == 0) {
                return false;
            }
        }
        return true;
    }
}
